package com.mall.controller;

import com.mall.common.R;
import com.mall.entity.TbSeckillVoucher;
import com.mall.service.Impl.SmoothMallOrderServiceImpl;
import com.mall.service.SmoothMallOrderService;
import com.mall.service.TbSeckillVoucherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.transform.Result;

@RestController
@RequestMapping("/voucherOrder")
public class VoucherOrderController {
    @Autowired
    SmoothMallOrderService smoothMallOrderService;
    @Autowired
    TbSeckillVoucherService seckillVoucherService;
    @PostMapping("/seckill/{id}")
    public R seckillVoucher(@PathVariable("id") Long voucherId) {
        R r = smoothMallOrderService.seckillVoucher(voucherId);
        return r;
    }
    @PostMapping("/add")
    public void addVoucher(@RequestBody TbSeckillVoucher seckillVoucher){
        seckillVoucherService.addSeckillVoucher(seckillVoucher);
    }
}